unit dgAddLine ;

interface

uses Windows,
   SysUtils,
   Classes,
   Graphics,
   Forms,
   Controls,
   StdCtrls,
   Buttons,
   ExtCtrls,
   TntStdCtrls,
   SpTBXEditors,
   SpTBXControls,
   TBXDkPanels,
   uBasic,
   uObjects,
   GDIPAPI,
   GDIPOBJ ;

type
   TdlgAddLine = class( TForm )
      SpTBXPanel1 : TSpTBXPanel ;
      Panel : TSpTBXPanel ;
      SpTBXButton1 : TSpTBXButton ;
      SpTBXButton2 : TSpTBXButton ;
      SpTBXGroupBox2 : TSpTBXGroupBox ;
      SpTBXGroupBox3 : TSpTBXGroupBox ;
      SpTBXGroupBox1 : TSpTBXGroupBox ;
      seOriginX : TSpTBXSpinEdit ;
      seOriginY : TSpTBXSpinEdit ;
      seCoor2X : TSpTBXSpinEdit ;
      seCoor2Y : TSpTBXSpinEdit ;
      cbType : TSpTBXComboBox ;
      SpTBXGroupBox4 : TSpTBXGroupBox ;
      seCoor1X : TSpTBXSpinEdit ;
      seCoor1Y : TSpTBXSpinEdit ;
      procedure SpTBXButton1Click( Sender : TObject ) ;
   private
      fLine : TMedaWire ;
      procedure SetTitle( const Value : string ) ;
      procedure SetLine( const Value : TMedaWire ) ;
   public
      property Title : string write SetTitle ;
      property Line : TMedaWire read FLine write SetLine ;
   end ;

implementation

{$R *.dfm}

{ TdlgAddLine }

procedure TdlgAddLine.SetLine( const Value : TMedaWire ) ;
begin
   FLine := Value ;
   if assigned( fLine ) then begin
      seOriginX.Value := fLine.Position.X ;
      seOriginY.Value := fLine.Position.Y ;
   end ;
end ;

procedure TdlgAddLine.SetTitle( const Value : string ) ;
begin
   Caption := Value ;
end ;

procedure TdlgAddLine.SpTBXButton1Click( Sender : TObject ) ;
var
   iTransform       : TMedaTransform ;
begin
   if assigned( fLine ) then begin
      iTransform := fLine.Transforms[ 0 ] ;
      iTransform.Position := Makepoint( seOriginX.Value, seOriginY.Value ) ;
      fLine.Transforms[ 0 ] := iTransform ;
   end ;
end ;

end.

